<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QStringMatcher Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStringMatcher Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QStringMatcher class holds a sequence of characters that can
be quickly matched in a Unicode string. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher-2">__init__</a></b> (<i>self</i>, QString&#160;<i>pattern</i>, Qt.CaseSensitivity&#160;<i>cs</i>&#160;=&#160;Qt.CaseSensitive)</li><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher-3">__init__</a></b> (<i>self</i>, QStringMatcher&#160;<i>other</i>)</li><li><div class="fn" />Qt.CaseSensitivity <b><a href="qstringmatcher.html#caseSensitivity">caseSensitivity</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qstringmatcher.html#indexIn">indexIn</a></b> (<i>self</i>, QString&#160;<i>str</i>, int&#160;<i>from</i>&#160;=&#160;0)</li><li><div class="fn" />QString <b><a href="qstringmatcher.html#pattern">pattern</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a></b> (<i>self</i>, Qt.CaseSensitivity&#160;<i>cs</i>)</li><li><div class="fn" /><b><a href="qstringmatcher.html#setPattern">setPattern</a></b> (<i>self</i>, QString&#160;<i>pattern</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStringMatcher class holds a sequence of characters that can
be quickly matched in a Unicode string.</p>
<p>This class is useful when you have a sequence of <a href="qchar.html">QChar</a>s that you want to repeatedly match against
some strings (perhaps in a loop), or when you want to search for
the same sequence of characters multiple times in the same string.
Using a matcher object and <a href="qstringmatcher.html#indexIn">indexIn</a>() is faster than matching
a plain <a href="qstring.html">QString</a> with <a href="qstring.html#indexOf">QString.indexOf</a>() if repeated matching
takes place. This class offers no benefit if you are doing one-off
string matches.</p>
<p>Create the QStringMatcher with the <a href="qstring.html">QString</a> you want to search for. Then call
<a href="qstringmatcher.html#indexIn">indexIn</a>() on the <a href="qstring.html">QString</a> that you want to search.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStringMatcher" />QStringMatcher.__init__ (<i>self</i>)</h3><p>Constructs an empty string matcher that won't match anything.
Call <a href="qstringmatcher.html#setPattern">setPattern</a>() to
give it a pattern to match.</p>


<h3 class="fn"><a name="QStringMatcher-2" />QStringMatcher.__init__ (<i>self</i>, QString&#160;<i>pattern</i>, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a>&#160;<i>cs</i>&#160;=&#160;Qt.CaseSensitive)</h3><p>Constructs a string matcher that will search for <i>pattern</i>,
with case sensitivity <i>cs</i>.</p>
<p>Call <a href="qstringmatcher.html#indexIn">indexIn</a>() to
perform a search.</p>


<h3 class="fn"><a name="QStringMatcher-3" />QStringMatcher.__init__ (<i>self</i>, <a href="qstringmatcher.html">QStringMatcher</a>&#160;<i>other</i>)</h3><p>Constructs a string matcher that will search for the pattern
referred to by <i>uc</i> with the given <i>length</i> and case
sensitivity specified by <i>cs</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="caseSensitivity" /><a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a> QStringMatcher.caseSensitivity (<i>self</i>)</h3><p>Returns the case sensitivity setting for this string
matcher.</p>
<p><b>See also</b> <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>().</p>


<h3 class="fn"><a name="indexIn" />int QStringMatcher.indexIn (<i>self</i>, QString&#160;<i>str</i>, int&#160;<i>from</i>&#160;=&#160;0)</h3><p>Searches the string <i>str</i> from character position
<i>from</i> (default 0, i.e. from the first character), for the
string <a href="qstringmatcher.html#pattern">pattern</a>() that was
set in the constructor or in the most recent call to <a href="qstringmatcher.html#setPattern">setPattern</a>(). Returns the
position where the <a href="qstringmatcher.html#pattern">pattern</a>() matched in <i>str</i>,
or -1 if no match was found.</p>
<p><b>See also</b> <a href="qstringmatcher.html#setPattern">setPattern</a>() and <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>().</p>


<h3 class="fn"><a name="pattern" />QString QStringMatcher.pattern (<i>self</i>)</h3><p>Returns the string pattern that this string matcher will search
for.</p>
<p><b>See also</b> <a href="qstringmatcher.html#setPattern">setPattern</a>().</p>


<h3 class="fn"><a name="setCaseSensitivity" />QStringMatcher.setCaseSensitivity (<i>self</i>, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a>&#160;<i>cs</i>)</h3><p>Sets the case sensitivity setting of this string matcher to
<i>cs</i>.</p>
<p><b>See also</b> <a href="qstringmatcher.html#caseSensitivity">caseSensitivity</a>(),
<a href="qstringmatcher.html#setPattern">setPattern</a>(), and
<a href="qstringmatcher.html#indexIn">indexIn</a>().</p>


<h3 class="fn"><a name="setPattern" />QStringMatcher.setPattern (<i>self</i>, QString&#160;<i>pattern</i>)</h3><p>Sets the string that this string matcher will search for to
<i>pattern</i>.</p>
<p><b>See also</b> <a href="qstringmatcher.html#pattern">pattern</a>(), <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>(),
and <a href="qstringmatcher.html#indexIn">indexIn</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>